import request from 'src/axios'

/**
 * @description 分页查询流程监听器
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageListener = (params: object) => {
  return request.get('/flow/flowListener/page', { params })
}

/**
 * @description 查看流程监听器
 * @param { String } id 主键
 * @returns Promise
 */
export const viewListener = (id: string) => {
  return request.get('/flow/flowListener', { params: { id } })
}

/**
 * @description 新增流程监听器
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveListener = (data: object) => {
  return request.post('/flow/flowListener', data)
}

/**
 * @description 修改流程监听器
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateListener = (data: object) => {
  return request.put('/flow/flowListener', data)
}

/**
 * @description 删除流程监听器
 * @param { Array<string> } ids 主键数组
 * @returns Promise
 */
export const deleteListener = (ids: Array<string>) => {
  return request.delete('/flow/flowListener', { data: ids })
}

/**
 * @description 启用流程监听器
 * @param { String } id 主键
 * @returns Promise
 */
export const enableListener = (id: string) => {
  return request.put('/flow/flowListener/enable', { id })
}

/**
 * @description 禁用流程监听器
 * @param { String } id 主键
 * @returns Promise
 */
export const disableListener = (id: string) => {
  return request.put('/flow/flowListener/disable', { id })
}
